# **********************************************************************
#
# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

# Ice version 3.3.1
# Generated from file `Motor.ice'

import Ice, IcePy, __builtin__

if not Ice.__dict__.has_key("_struct_marker"):
    Ice._struct_marker = object()
import TeRKCommon_ice

# Included module Ice
_M_Ice = Ice.openModule('Ice')

# Included module Glacier2
_M_Glacier2 = Ice.openModule('Glacier2')

# Included module peer
_M_peer = Ice.openModule('peer')

# Included module TeRK
_M_TeRK = Ice.openModule('TeRK')

# Start of module TeRK
__name__ = 'TeRK'

if not _M_TeRK.__dict__.has_key('MotorMode'):
    _M_TeRK.MotorMode = Ice.createTempClass()
    class MotorMode(object):

        def __init__(self, val):
            assert(val >= 0 and val < 3)
            self.value = val

        def __str__(self):
            if self.value == 0:
                return 'MotorSpeedControl'
            elif self.value == 1:
                return 'MotorPositionControl'
            elif self.value == 2:
                return 'MotorOff'
            return None

        __repr__ = __str__

        def __hash__(self):
            return self.value

        def __cmp__(self, other):
            return cmp(self.value, other.value)

    MotorMode.MotorSpeedControl = MotorMode(0)
    MotorMode.MotorPositionControl = MotorMode(1)
    MotorMode.MotorOff = MotorMode(2)

    _M_TeRK._t_MotorMode = IcePy.defineEnum('::TeRK::MotorMode', MotorMode, (), (MotorMode.MotorSpeedControl, MotorMode.MotorPositionControl, MotorMode.MotorOff))

    _M_TeRK.MotorMode = MotorMode
    del MotorMode

if not _M_TeRK.__dict__.has_key('_t_MotorModeArray'):
    _M_TeRK._t_MotorModeArray = IcePy.defineSequence('::TeRK::MotorModeArray', (), _M_TeRK._t_MotorMode)

if not _M_TeRK.__dict__.has_key('MotorException'):
    _M_TeRK.MotorException = Ice.createTempClass()
    class MotorException(_M_TeRK.TeRKException):
        def __init__(self, reason=''):
            _M_TeRK.TeRKException.__init__(self, reason)

        def ice_name(self):
            return 'TeRK::MotorException'

        def __str__(self):
            return IcePy.stringifyException(self)

        __repr__ = __str__

    _M_TeRK._t_MotorException = IcePy.defineException('::TeRK::MotorException', MotorException, (), _M_TeRK._t_TeRKException, ())
    MotorException.ice_type = _M_TeRK._t_MotorException

    _M_TeRK.MotorException = MotorException
    del MotorException

if not _M_TeRK.__dict__.has_key('MotorCommandException'):
    _M_TeRK.MotorCommandException = Ice.createTempClass()
    class MotorCommandException(_M_TeRK.CommandException):
        def __init__(self, reason=''):
            _M_TeRK.CommandException.__init__(self, reason)

        def ice_name(self):
            return 'TeRK::MotorCommandException'

        def __str__(self):
            return IcePy.stringifyException(self)

        __repr__ = __str__

    _M_TeRK._t_MotorCommandException = IcePy.defineException('::TeRK::MotorCommandException', MotorCommandException, (), _M_TeRK._t_CommandException, ())
    MotorCommandException.ice_type = _M_TeRK._t_MotorCommandException

    _M_TeRK.MotorCommandException = MotorCommandException
    del MotorCommandException

if not _M_TeRK.__dict__.has_key('MotorBuffer'):
    _M_TeRK.MotorBuffer = Ice.createTempClass()
    class MotorBuffer(object):
        def __init__(self, values=None):
            self.values = values

        def __hash__(self):
            _h = 0
            if self.values:
                for _i0 in self.values:
                    _h = 5 * _h + __builtin__.hash(_i0)
            return _h % 0x7fffffff

        def __cmp__(self, other):
            if other == None:
                return 1
            if self.values < other.values:
                return -1
            elif self.values > other.values:
                return 1
            return 0

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_MotorBuffer)

        __repr__ = __str__

    _M_TeRK._t_MotorBuffer = IcePy.defineStruct('::TeRK::MotorBuffer', MotorBuffer, (), (('values', (), _M_TeRK._t_IntArray),))

    _M_TeRK.MotorBuffer = MotorBuffer
    del MotorBuffer

if not _M_TeRK.__dict__.has_key('_t_MotorBufferArray'):
    _M_TeRK._t_MotorBufferArray = IcePy.defineSequence('::TeRK::MotorBufferArray', (), _M_TeRK._t_MotorBuffer)

if not _M_TeRK.__dict__.has_key('MotorState'):
    _M_TeRK.MotorState = Ice.createTempClass()
    class MotorState(object):
        def __init__(self, motorVelocities=None, motorPositions=None, motorCurrents=None, motorDutyCycles=None, motorDone=None):
            self.motorVelocities = motorVelocities
            self.motorPositions = motorPositions
            self.motorCurrents = motorCurrents
            self.motorDutyCycles = motorDutyCycles
            self.motorDone = motorDone

        def __hash__(self):
            _h = 0
            if self.motorVelocities:
                for _i0 in self.motorVelocities:
                    _h = 5 * _h + __builtin__.hash(_i0)
            if self.motorPositions:
                for _i1 in self.motorPositions:
                    _h = 5 * _h + __builtin__.hash(_i1)
            if self.motorCurrents:
                for _i2 in self.motorCurrents:
                    _h = 5 * _h + __builtin__.hash(_i2)
            if self.motorDutyCycles:
                for _i3 in self.motorDutyCycles:
                    _h = 5 * _h + __builtin__.hash(_i3)
            if self.motorDone:
                for _i4 in self.motorDone:
                    _h = 5 * _h + __builtin__.hash(_i4)
            return _h % 0x7fffffff

        def __cmp__(self, other):
            if other == None:
                return 1
            if self.motorVelocities < other.motorVelocities:
                return -1
            elif self.motorVelocities > other.motorVelocities:
                return 1
            if self.motorPositions < other.motorPositions:
                return -1
            elif self.motorPositions > other.motorPositions:
                return 1
            if self.motorCurrents < other.motorCurrents:
                return -1
            elif self.motorCurrents > other.motorCurrents:
                return 1
            if self.motorDutyCycles < other.motorDutyCycles:
                return -1
            elif self.motorDutyCycles > other.motorDutyCycles:
                return 1
            if self.motorDone < other.motorDone:
                return -1
            elif self.motorDone > other.motorDone:
                return 1
            return 0

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_MotorState)

        __repr__ = __str__

    _M_TeRK._t_MotorState = IcePy.defineStruct('::TeRK::MotorState', MotorState, (), (
        ('motorVelocities', (), _M_TeRK._t_IntArray),
        ('motorPositions', (), _M_TeRK._t_IntArray),
        ('motorCurrents', (), _M_TeRK._t_IntArray),
        ('motorDutyCycles', (), _M_TeRK._t_IntArray),
        ('motorDone', (), _M_TeRK._t_BooleanArray)
    ))

    _M_TeRK.MotorState = MotorState
    del MotorState

if not _M_TeRK.__dict__.has_key('MotorCommand'):
    _M_TeRK.MotorCommand = Ice.createTempClass()
    class MotorCommand(object):
        def __init__(self, motorMask=None, motorModes=None, motorPositions=None, motorVelocities=None, motorAccelerations=None):
            self.motorMask = motorMask
            self.motorModes = motorModes
            self.motorPositions = motorPositions
            self.motorVelocities = motorVelocities
            self.motorAccelerations = motorAccelerations

        def __hash__(self):
            _h = 0
            if self.motorMask:
                for _i0 in self.motorMask:
                    _h = 5 * _h + __builtin__.hash(_i0)
            if self.motorModes:
                for _i1 in self.motorModes:
                    _h = 5 * _h + __builtin__.hash(_i1)
            if self.motorPositions:
                for _i2 in self.motorPositions:
                    _h = 5 * _h + __builtin__.hash(_i2)
            if self.motorVelocities:
                for _i3 in self.motorVelocities:
                    _h = 5 * _h + __builtin__.hash(_i3)
            if self.motorAccelerations:
                for _i4 in self.motorAccelerations:
                    _h = 5 * _h + __builtin__.hash(_i4)
            return _h % 0x7fffffff

        def __cmp__(self, other):
            if other == None:
                return 1
            if self.motorMask < other.motorMask:
                return -1
            elif self.motorMask > other.motorMask:
                return 1
            if self.motorModes < other.motorModes:
                return -1
            elif self.motorModes > other.motorModes:
                return 1
            if self.motorPositions < other.motorPositions:
                return -1
            elif self.motorPositions > other.motorPositions:
                return 1
            if self.motorVelocities < other.motorVelocities:
                return -1
            elif self.motorVelocities > other.motorVelocities:
                return 1
            if self.motorAccelerations < other.motorAccelerations:
                return -1
            elif self.motorAccelerations > other.motorAccelerations:
                return 1
            return 0

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_MotorCommand)

        __repr__ = __str__

    _M_TeRK._t_MotorCommand = IcePy.defineStruct('::TeRK::MotorCommand', MotorCommand, (), (
        ('motorMask', (), _M_TeRK._t_BooleanArray),
        ('motorModes', (), _M_TeRK._t_MotorModeArray),
        ('motorPositions', (), _M_TeRK._t_IntArray),
        ('motorVelocities', (), _M_TeRK._t_IntArray),
        ('motorAccelerations', (), _M_TeRK._t_IntArray)
    ))

    _M_TeRK.MotorCommand = MotorCommand
    del MotorCommand

if not _M_TeRK.__dict__.has_key('MotorController'):
    _M_TeRK.MotorController = Ice.createTempClass()
    class MotorController(_M_TeRK.AbstractCommandController):
        def __init__(self):
            if __builtin__.type(self) == _M_TeRK.MotorController:
                raise RuntimeError('TeRK.MotorController is an abstract class')

        def ice_ids(self, current=None):
            return ('::Ice::Object', '::TeRK::AbstractCommandController', '::TeRK::MotorController', '::TeRK::PropertyManager')

        def ice_id(self, current=None):
            return '::TeRK::MotorController'

        def ice_staticId():
            return '::TeRK::MotorController'
        ice_staticId = staticmethod(ice_staticId)

        #
        # Operation signatures.
        #
        # def execute(self, command, current=None):
        # def getFrequency(self, current=None):
        # def startMotorBufferRecord(self, motorMask, current=None):
        # def stopMotorBufferRecord(self, motorMask, current=None):
        # def getMotorBuffers(self, motorMask, current=None):
        # def setMotorBuffer(self, motorMask, motorBuffers, current=None):
        # def playMotorBuffer(self, motorMask, current=None):

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_MotorController)

        __repr__ = __str__

    _M_TeRK.MotorControllerPrx = Ice.createTempClass()
    class MotorControllerPrx(_M_TeRK.AbstractCommandControllerPrx):

        def execute(self, command, _ctx=None):
            return _M_TeRK.MotorController._op_execute.invoke(self, ((command, ), _ctx))

        def execute_async(self, _cb, command, _ctx=None):
            return _M_TeRK.MotorController._op_execute.invokeAsync(self, (_cb, (command, ), _ctx))

        def getFrequency(self, _ctx=None):
            return _M_TeRK.MotorController._op_getFrequency.invoke(self, ((), _ctx))

        def getFrequency_async(self, _cb, _ctx=None):
            return _M_TeRK.MotorController._op_getFrequency.invokeAsync(self, (_cb, (), _ctx))

        def startMotorBufferRecord(self, motorMask, _ctx=None):
            return _M_TeRK.MotorController._op_startMotorBufferRecord.invoke(self, ((motorMask, ), _ctx))

        def startMotorBufferRecord_async(self, _cb, motorMask, _ctx=None):
            return _M_TeRK.MotorController._op_startMotorBufferRecord.invokeAsync(self, (_cb, (motorMask, ), _ctx))

        def stopMotorBufferRecord(self, motorMask, _ctx=None):
            return _M_TeRK.MotorController._op_stopMotorBufferRecord.invoke(self, ((motorMask, ), _ctx))

        def stopMotorBufferRecord_async(self, _cb, motorMask, _ctx=None):
            return _M_TeRK.MotorController._op_stopMotorBufferRecord.invokeAsync(self, (_cb, (motorMask, ), _ctx))

        def getMotorBuffers(self, motorMask, _ctx=None):
            return _M_TeRK.MotorController._op_getMotorBuffers.invoke(self, ((motorMask, ), _ctx))

        def getMotorBuffers_async(self, _cb, motorMask, _ctx=None):
            return _M_TeRK.MotorController._op_getMotorBuffers.invokeAsync(self, (_cb, (motorMask, ), _ctx))

        def setMotorBuffer(self, motorMask, motorBuffers, _ctx=None):
            return _M_TeRK.MotorController._op_setMotorBuffer.invoke(self, ((motorMask, motorBuffers), _ctx))

        def setMotorBuffer_async(self, _cb, motorMask, motorBuffers, _ctx=None):
            return _M_TeRK.MotorController._op_setMotorBuffer.invokeAsync(self, (_cb, (motorMask, motorBuffers), _ctx))

        def playMotorBuffer(self, motorMask, _ctx=None):
            return _M_TeRK.MotorController._op_playMotorBuffer.invoke(self, ((motorMask, ), _ctx))

        def playMotorBuffer_async(self, _cb, motorMask, _ctx=None):
            return _M_TeRK.MotorController._op_playMotorBuffer.invokeAsync(self, (_cb, (motorMask, ), _ctx))

        def checkedCast(proxy, facetOrCtx=None, _ctx=None):
            return _M_TeRK.MotorControllerPrx.ice_checkedCast(proxy, '::TeRK::MotorController', facetOrCtx, _ctx)
        checkedCast = staticmethod(checkedCast)

        def uncheckedCast(proxy, facet=None):
            return _M_TeRK.MotorControllerPrx.ice_uncheckedCast(proxy, facet)
        uncheckedCast = staticmethod(uncheckedCast)

    _M_TeRK._t_MotorControllerPrx = IcePy.defineProxy('::TeRK::MotorController', MotorControllerPrx)

    _M_TeRK._t_MotorController = IcePy.defineClass('::TeRK::MotorController', MotorController, (), True, None, (_M_TeRK._t_AbstractCommandController,), ())
    MotorController.ice_type = _M_TeRK._t_MotorController

    MotorController._op_execute = IcePy.Operation('execute', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), _M_TeRK._t_MotorCommand),), (), _M_TeRK._t_MotorState, (_M_TeRK._t_MotorCommandException,))
    MotorController._op_getFrequency = IcePy.Operation('getFrequency', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (), (), IcePy._t_int, ())
    MotorController._op_startMotorBufferRecord = IcePy.Operation('startMotorBufferRecord', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), _M_TeRK._t_BooleanArray),), (), None, (_M_TeRK._t_MotorException,))
    MotorController._op_stopMotorBufferRecord = IcePy.Operation('stopMotorBufferRecord', Ice.OperationMode.Idempotent, Ice.OperationMode.Idempotent, False, (), (((), _M_TeRK._t_BooleanArray),), (), None, (_M_TeRK._t_MotorException,))
    MotorController._op_getMotorBuffers = IcePy.Operation('getMotorBuffers', Ice.OperationMode.Nonmutating, Ice.OperationMode.Nonmutating, False, (), (((), _M_TeRK._t_BooleanArray),), (), _M_TeRK._t_MotorBufferArray, (_M_TeRK._t_MotorException,))
    MotorController._op_setMotorBuffer = IcePy.Operation('setMotorBuffer', Ice.OperationMode.Idempotent, Ice.OperationMode.Idempotent, False, (), (((), _M_TeRK._t_BooleanArray), ((), _M_TeRK._t_MotorBufferArray)), (), None, (_M_TeRK._t_MotorException,))
    MotorController._op_playMotorBuffer = IcePy.Operation('playMotorBuffer', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), _M_TeRK._t_BooleanArray),), (), None, (_M_TeRK._t_MotorException,))

    _M_TeRK.MotorController = MotorController
    del MotorController

    _M_TeRK.MotorControllerPrx = MotorControllerPrx
    del MotorControllerPrx

# End of module TeRK
